package com.wuming.caiwu.core;

/**
 * 理赔状态
 * Created by hanfei on 16/5/10.
 */
public enum OrderStatusEnum {
    /**
     * 未支付
     */
    NOT_PAY(12,"未支付"),
    /**
     * 已付款
     */
    HAS_PAY(1, "已付款"),

    /**
     * 已发货
     */
    HAS_SEND_GOODS(2, "已发货"),

    /**
     * 已收货
     */
    HAS_RECEIVE_GOODS(3, "已收货"),

    /**
     * 已完成
     */
    HAS_COMPLETED(4, "已完成"),

    /**
     * 等待结算
     */
    WAIT_JIESUAN(5, "等待结算"),

    /**
     * 已结算
     */
    HAS_JIESUAN(6, "已结算");

    private int value;
    private String desc;

    private OrderStatusEnum(int value, String desc) {
        this.setValue(value);
        this.setDesc(desc);
    }

    public static Integer getStatusValueByDesc(String desc){
        OrderStatusEnum[] claimOrderStatus = values();
        for (OrderStatusEnum status: claimOrderStatus
             ) {
            if(status.getDesc().equalsIgnoreCase(desc)){
                return status.getValue();
            }
        }
        return null;
    }

    public static String getDescByStatusValue(Integer value){
        OrderStatusEnum[] claimOrderStatus = values();
        for (OrderStatusEnum status: claimOrderStatus
        ) {
            if(status.getValue()==value){
                return status.getDesc();
            }
        }
        return null;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    @Override
    public String toString() {
        return "[" + this.value + "]" + this.desc;
    }
    
    public static void main(String[] args){
        System.out.println(getStatusValueByDesc("考试截图中"));
    }
}
